package com.itheima.app.controller;

import com.itheima.app.manager.MakeFriendManager;
import com.itheima.app.manager.MovementManager;
import com.itheima.domain.mongo.Movement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class MakeFriendController {

    @Autowired
    private MakeFriendManager makeFriendManager;
    //今日佳人
    @GetMapping("/tanhua/todayBest")
    public ResponseEntity todayBest() throws IOException {
        return makeFriendManager.todayBest();
    }


    //推荐列表
    @GetMapping("/tanhua/recommendation")
    public ResponseEntity recommendation(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer pagesize
    ) throws IOException {
        return makeFriendManager.recommendation(page , pagesize);
    }

    //查询推荐人用户详情
    @GetMapping("/tanhua/{jiarenId}/personalInfo")
    public ResponseEntity personalInfo(
            @PathVariable Long jiarenId
    ) throws IOException {
        return makeFriendManager.personalInfo(jiarenId);
    }


    //查询是否喜欢该用户
    @GetMapping("/users/{jiarenId}/alreadyLove")
    public ResponseEntity alreadyLove(
            @PathVariable Long jiarenId
    ) throws IOException {
        return ResponseEntity.ok( false ); //TODO 不喜欢  这个接口 将来做项目实战的时候 是需要自己回来编写
    }

    //查看最近访客
    @GetMapping("/movements/visitors")
    public ResponseEntity findVisitors(

    ) throws IOException {
        return makeFriendManager.findVisitors();
    }


    //搜附近
    @GetMapping("/tanhua/search")
    public ResponseEntity search(
            String gender ,
            Long distance  //前端传入过来的是米
    ) throws IOException {
        return makeFriendManager.search(gender, distance);
    }
}
